﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Application.Interfaces;
using Domain.Common;

namespace Application.UserManagement
{
    using Domain.UserManagement;
    using Domain.UserManagement.Entities;

    public class AuthoriseLoginService : IAuthoriseLoginService
    {
        private IUserRepository userRepository;

        public AuthoriseLoginService(IUserRepository userRepos)
        {
            if (userRepos == null)
            {
                throw new ArgumentNullException();
            }

            this.userRepository = userRepos;
        }


        public bool Identify(LoginAttempt attempt)
        {
            var foundUser = userRepository.Get(attempt);

            if (foundUser == null)
                return false;
            else
                return true;
        }
    }
}
